package plugin

import (
	"context"

	"github.com/bytedance/go-tagexpr/v2/binding"
	"github.com/cloudwego/hertz/pkg/common/hlog"
)

// 请求参数验证插件（前置验证）
type Vd struct {
}

func (this *Vd) PreCall(ctx context.Context, serviceName, methodName string, args interface{}) (interface{}, error) {
	var err error
	if err = binding.Validate(args); err != nil {
		hlog.Debugf("params invalid,err:%s", err.Error())
	}
	return args, err
}

//func (this *VdPlugin) PostCall(ctx context.Context, serviceName, methodName string, args, reply interface{}, err error) (interface{}, error) {
//	//do nothing
//	return reply, nil
//}
